package model

import (
	"manager/model/entity"
)

// PromotionalImageCreateRequest 创建现场数据
type PromotionalImageCreateRequest struct {
	Name string `json:"name"`

	Desc string `json:"desc"`

	ImageUrl string `json:"image_url"`

	Weight int `json:"weight"`

	UpdatedAt int64 `json:"updated_at"`
}

// PromotionalImageUpdateRequest 更新现场数据
type PromotionalImageUpdateRequest struct {
	Id int64 `json:"id"`

	Name *string `json:"name"`

	Desc *string `json:"desc"`

	ImageUrl *string `json:"image_url"`

	Weight *int `json:"weight"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt *int64 `json:"updated_at"`
}

// PromotionalImageListRequest 列表现场数据
type PromotionalImageListRequest struct {
	Index int `json:"index"`
	Size  int `json:"size"`

	Id int64 `json:"id"`

	Name *string `json:"name"`

	Desc *string `json:"desc"`

	ImageUrl *string `json:"image_url"`

	Weight *int `json:"weight"`

	UpdatedAt *int64 `json:"updated_at"`
}

// PromotionalImageListResponse 列表回包数据
type PromotionalImageListResponse struct {
	Total int                     `json:"total"`
	List  []*PromotionalImageInfo `json:"list"`
}

// PromotionalImageInfoRequest 列表现场数据
type PromotionalImageInfoRequest struct {
	Id int64 `json:"id"`

	Name *string `json:"name"`

	Desc *string `json:"desc"`

	ImageUrl *string `json:"image_url"`

	Weight *int `json:"weight"`

	UpdatedAt *int64 `json:"updated_at"`
}

// PromotionalImageInfo 详细数据
type PromotionalImageInfo struct {
	Id int64 `json:"id"`

	Name string `json:"name"`

	Desc string `json:"desc"`

	ImageUrl string `json:"image_url"`

	Weight int `json:"weight"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt int64 `json:"updated_at"`
}

// PromotionalImageDeleteRequest 删除现场数据
type PromotionalImageDeleteRequest struct {
	Id int64 `json:"id"`
}

// PromotionalImagesEntityToDto entity数据转换
func PromotionalImagesEntityToDto(promotionalImages []*entity.PromotionalImage) []*PromotionalImageInfo {
	out := make([]*PromotionalImageInfo, 0, len(promotionalImages))
	for _, c := range promotionalImages {
		out = append(out, PromotionalImageEntityToDto(c))
	}
	return out
}

// PromotionalImageEntityToDto entity数据转换
func PromotionalImageEntityToDto(e *entity.PromotionalImage) *PromotionalImageInfo {
	return &PromotionalImageInfo{

		Id: e.Id,

		Name: e.Name,

		Desc: e.Desc,

		ImageUrl: e.ImageUrl,

		Weight: e.Weight,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
